/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

/**
 *
 * @author Mikkel
 */
public class Address {

    private int ID;
    private String company;
    private String address;
    private String zipcode;
    private String city;
    private String district;
    private String country;

    public Address(int ID, String company, String address, String zipcode, String city, String district, String country) {
        this.ID = ID;
        this.company = company;
        this.address = address;
        this.zipcode = zipcode;
        this.city = city;
        this.district = district;
        this.country = country;
    }

    public Address(String company, String address, String zipcode, String city, String district, String country) {
        this.company = company;
        this.address = address;
        this.zipcode = zipcode;
        this.city = city;
        this.district = district;
        this.country = country;
    }
    
    
    public String getCompany(){
        return company;
    }

    public String getAddress() {
        return address;
    }

    public String getZipcode() {
        return zipcode;
    }

    public String getCity() {
        return city;
    }
    
    public int getID() {
        return ID;
    }

    public String getDistrict() {
        return district;
    }

    public String getCountry() {
        return country;
    }
    
    public String toStringSQL() {
        String sql;
        if((company == null || company.equals("")) && (district == null || district.equals(""))){           
            sql = "(null, '" + address + "', '" + zipcode + "', '" + city + "', null, '"+country+"')"; 
        } else if(company == null || company.equals("")){
            sql= "(null, '" + address + "', '" + zipcode + "', '" + city + "', '"+district+"', '"+country+"')";
        }else if(district== null || district.equals("")){
            sql = "('" + company + "', '" + address + "', '" + zipcode + "', '" + city + "', null, '"+country+"')";
        } else{
            sql="('" + company + "', '" + address + "', '" + zipcode + "', '" + city + "', '"+district+"', '"+country+"')";
        }
        return sql;
    }

    @Override
    public String toString() {
        String svar;
        if(district== null || district.equals("")){
            svar = company + "\n" + address + "\n" + zipcode + "\n" + city + "\n" + country;
        } else if(company == null){
            svar = address + "\n" + zipcode + "\n" + city + "\n" + district + "\n" + country;
        }else if(district == null && company == null){           
            svar = address + "\n" + zipcode + "\n" + city + "\n" + country;
        }else{
            svar = company + "\n" + address + "\n" + zipcode + "\n" + city + "\n" + district + "\n" + country;
        }
        return svar;
    }
}
